#include<bits/stdc++.h>

using namespace std;
//奇数幻方
int a[31][31];
int n, m, k;

int main() {
    while (cin >> n) {
        if (n == 0)break;
        memset(a, 0, sizeof(a));//数组淸0
        int x = n - 1, y = n / 2;
        a[x][y] = 1;


        for (int k = 2; k <= n * n; k++) {
            int nx = (x + 1) % n;
            int ny = (y + 1) % n;
            if (a[nx][ny] == 0) {
                a[nx][ny] = k;
                x = nx;
                y = ny;

            } else {
                nx = (x - 1 + n) % n;
                ny = y;
                a[nx][ny] = k;
                x = nx;
                y = ny;
            }

        }

        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                cout << a[i][j] << " ";
            }
            cout << endl;
        }
        cout << endl;


    }


    return 0;
}
